package company.chubao;

import java.util.Arrays;
import java.util.Scanner;

public class Chu3A {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        long[] array = new long[n];
        for (int i = 0; i < n; i++) {
            array[i] = sc.nextLong();
        }
        long min = sc.nextLong();
        Arrays.sort(array);
        long sum = 0;
        for (int i = n - 1; i >= 0; i -= 2) {
            sum += array[i];
        }
        int result = min >= sum ? 1 : 0;
        System.out.println(result);
    }
}
